<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<link rel="stylesheet" type="text/css" href="../js/themes/bootstrap/easyui.css">
	<link rel="stylesheet" type="text/css" href="../js/themes/icon.css">
	<link rel="stylesheet" type="text/css" href="../demo/demo.css">
	<script type="text/javascript" src="../js/jquery.min.js"></script>
	<script type="text/javascript" src="../js/jquery.easyui.min.js"></script>
	<script type="text/javascript" src="../js/locale/easyui-lang-zh_CN.js"></script>
	<script type="text/javascript">
		var  update;	
		$(function(){
			update = $("#update").dialog({closable:false,

				});
			});
	</script>
	<script type="text/javascript">
			
			
			
			$.extend($.fn.validatebox.defaults.rules, {    
			    equals: {    
			        validator: function(value,param){    
			        	console.log(value+","+param);
			            return value == $(param[0]).val();    
			        },    
			        message: '密码不匹配请重新输入.'   
			    }    
			}); 
			
		function changePwd(){
			$.ajax({
				type:"GET",
		    	async: false,
		   	 	url:"<%=path %>/login/update/user",
		   		data :{"userid":$("#userid").val(),"password":$("#newpwd").val()},
		   		dataType: "json",
		    	success:function(data){
					var num = data.status;
					if(num==0){
						alert("修改密码成功");
						}
			    	}
				});
		}
	</script>
	<style>
		#oldpwd{
	border: 1px solid #ddd;
	width: 120px;
  	margin: 5px 0px;
	line-height:20px;
	height: 20px;
	padding: 0 5px;
	

	}
		#newpwd{
	border: 1px solid #ddd;
	width: 120px;
	line-height:20px;
	height: 20px;
	padding: 0 5px;
	
	}
		#confirmpwd{
  border: 1px solid #ddd;
  width: 120px;
  line-height: 20px;
  height: 20px;
  padding: 0 5px;
  margin: 5px 0px;

	}
	</style>
<title>Insert title here</title>
</head>
<body>
			<form id="updatePwd" method="post">
				<table align="center" >
					<tr>
						<td>
							<input  value="<%= request.getParameter("pwd")%>" type="password" id="oldpwd" onblur="doAction()" onfocus="if(this.value=='请输入旧密码'){value='';this.type='password';}" style="color:#CCC;"/>
						</td>
						<td id="t1"></td>
					</tr>
					<tr>
						<td>
							<input value="请输入新密码" id="newpwd" onblur="if(this.value==''){value='请输入新密码';this.type='text';}" onfocus="if(this.value=='请输入新密码'){value='';this.type='password';}" style="color:#CCC;" class="easyui-validatebox" data-options="required:true"/>
						</td>
					</tr>
					<tr>
						<td>
							<input value="请输入新密码" id="confirmpwd" onblur="if(this.value==''){value='请输入新密码';this.type='text';}" onfocus="if(this.value=='请输入新密码'){value='';this.type='password';}" style="color:#CCC;" class="easyui-validatebox"     
    					required="required" validType="equals['#newpwd']"/>  
						</td>
					</tr>
					<tr>
						<td><input type="button" value="确认" onclick="changePwd()"/><input type="button" value="重置"/></td>
					</tr>
				</table>
			</form>
	
</body>
</html>